package com.caigou.modules.famous.adpter

import android.widget.ProgressBar
import android.widget.TextView
import com.caigou.comm.base.ext.dareTypeBackgroundId
import com.caigou.modules.famous.R
import com.caigou.modules.famous.bean.MyRecordItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/12/08
 */
class MyRecordItemAdapter(dataset: MutableList<MyRecordItemBean>) :
    BaseQuickAdapter<MyRecordItemBean, BaseViewHolder>(R.layout.item_my_record_list, dataset) {

    override fun convert(holder: BaseViewHolder, item: MyRecordItemBean) {
        holder.getView<TextView>(R.id.item_my_record_tv_type).setBackgroundResource(dareTypeBackgroundId(item.dareTypeId))
        holder.setText(R.id.item_my_record_tv_type, item.dareTypeName)
        holder.setText(R.id.item_my_record_tv_type2, item.dareTypeName)
        holder.setText(R.id.item_my_record_tv_record, "战绩：${item.count}对${item.successCount}")
        holder.setText(R.id.item_my_record_tv_period, "第${item.period}期")
        holder.setText(R.id.item_my_record_tv_rate, "正确率${item.accuracy}%")
        holder.getView<ProgressBar>(R.id.item_my_record_process_bar_rate).progress = item.accuracy
        holder.setText(R.id.item_my_record_tv_like, item.nicePoint.toString())

    }
}